/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OneToMany;

/**
 *
 * @author Pierro
 */
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public class CompteJoint extends CompteBanquaire implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    
    private String type;
    
    
    // 1 client peut posseder plusieurs comptes joint
    @OneToMany(mappedBy = "compteJoint")
    private Collection<Client> listeClientsAssocies;
    
    

    public CompteJoint ()
    {
        super();
    }
    
    public CompteJoint(double soldeCompte)
    {
        super(soldeCompte);
        this.type = "CptJoint";
    }
    
   
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Collection<Client> getListeClientsAssocies() {
        return listeClientsAssocies;
    }

    public void setListeClientsAssocies(Collection<Client> listeClientsAssocies) {
        this.listeClientsAssocies = listeClientsAssocies;
    }

   
    
    
    
    

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CompteJoint)) {
            return false;
        }
        CompteJoint other = (CompteJoint) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.CompteJoint[ id=" + id + " ]";
    }
    
}
